/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved.
 * Description: ffts plus task dispatcher
 * Author: limengjiao
 * Create: 2023-05-01
 */

#include "ffts_ctx_provider.h"
#include "externalinput_pub.h"

using namespace std;

namespace hccl {
HcclFftsContextsInfo *FftsCtxProvider::GetFftsCtx(bool enableCache, const std::string &key)
{
    if (GetExternalInputQpSrcPortConfigPath() != "") {
        enableCache = false;
    } else if (GetExternalInputQpsPerConnection() != HCCL_QPS_PER_CONNECTION_DEFAULT) {
        enableCache = false;
    }
    if (UNLIKELY(!enableCache)) {
        alwaysNewFftsCtx.reset(new (std::nothrow) HcclFftsContextsInfo());
        return alwaysNewFftsCtx.get();
    }
    return &fftsCtxMap[key];
}
} // namespace hccl